<template>
  <div class="child">
    <h2>我是Child组件</h2>
    <h3>我的玩具：{{ toy }}</h3>
    <h3>我的电脑：{{ computer }}</h3>
    <h3>我的手机：{{ phone }}</h3>
    <button @click="$emit('send-toy',toy)">把玩具给父亲</button>
    <button @click="$emit('send-computer',computer)">把电脑给父亲</button>
    <button @click="$emit('send-phone',phone)">把手机给父亲</button>
    <button @click="$off('send-toy')">解绑send-toy事件</button>
    <button @click="$off()">解绑</button>
  </div>
</template>

<script>
  export default {
    name:'Child',
    data() {
      return {
        toy:'奥特曼',
        computer:'华硕',
        phone:'华为'
      }
    },
   /*  methods: {
      unbind(){
        this.$off('send-toy')
      }
    }, */
  }
</script>

<style scoped>
  .child {
    margin-top: 10px;
    background-color: skyblue;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 10px;
  }
</style>